//
//  TWBaseViewController.h
//  TWHomework-WeChat
//
//  Created by wzb on 2019/11/12.
//  Copyright © 2019 WZB. All rights reserved.
//

#import <UIKit/UIKit.h>

@class TWBaseViewModel;

NS_ASSUME_NONNULL_BEGIN

/// BaseViewController
@interface TWBaseViewController : UIViewController

/** 创建UI */
- (void)initUIView;

- (void)layoutUI;

/// 页面销毁时取消所有该页的网络请求
/// 通常只需写入[_viewModel cancelAllHTTPRequest];即可
- (void)deallocHTTPRequest;

/// 可以在子类中重写此方法用来绑定viewModel
- (void)initViewModelBinding;

/// 绑定viewModel
/// @param viewModel viewModel
- (TWBaseViewModel *)registerVM:(TWBaseViewModel *)viewModel;

/// 添加下拉刷新控件
/// @param scrollView 为哪一个scrollView添加
/// @param action 添加实现回调方法
- (void)addPullRefresh:(UIScrollView *)scrollView refreshingAction:(SEL)action;

/// 添加上拉加载更多控件
/// @param scrollView 为哪一个scrollView添加
/// @param action 添加实现回调方法
- (void)addPullLoadMore:(UIScrollView *)scrollView loadMoreAction:(SEL)action;

/// 显示没有更多数据
- (void)showNoMoreData:(UIScrollView *)scrollView;

/// 重置没有更多的数据（消除没有更多数据的状态）
- (void)resetNoMoreData:(UIScrollView *)scrollView;

/// 隐藏显示没有更多数据
- (void)hideNoMoreData:(UIScrollView *)scrollView;

/// 结束刷新
- (void)endRefresh:(UIScrollView *)scrollView;

@end

NS_ASSUME_NONNULL_END
